<template>
	<view style="height: 100vh;position: relative;background-color: #F6FAFA;">
		<view style="width: 100%;background: #ECF5F4;padding-left: 40rpx;padding-top: 30rpx;padding-bottom: 30rpx;">
			<view style="width: calc( 100% - 40rpx );text-align: left;">
				温馨提醒：急性病以当下状况为准，慢性病以近3天症状为准，请认真填写以便医生准确诊疗
			</view>
		</view>
		<view style="margin-top: 40rpx;">
			<view v-for="(item,index) in problemsList" :key="index" style="width: calc( 100% - 40rpx );margin: auto;background-color: #FFFFFF;padding-left: 40rpx;padding-top: 20rpx;">
				<view style="display: flex;align-items: center;justify-content: space-between;width: calc( 100% - 40rpx );margin-bottom: 20rpx;font-size: 30rpx;">
					<view style="display: flex;align-items: center;">
						<view style="background: #2FC6C1;border-radius: 12rpx;padding: 10rpx;color: #FFFFFF;">{{index<9?'0':''}}{{index+1}}</view>
						<view style="margin-left: 20rpx;">{{item.title}}</view>
					</view>
					<view style="color: #2A82E4;">{{item.type=='m'?'多选':'单选'}}</view>
				</view>
				<template v-if="item.type=='m'">
					<checkbox-group @change="changeCheckbox(index,$event)" style="width: calc( 100% - 40rpx );">
						<view style="width: 100%;display: flex;flex-flow: wrap;margin-top: 20rpx;padding-bottom: 20rpx;">
							<label v-for=" ( answerItem, answerIdx ) in item.answerList " :key="answerIdx" style="margin-right: 20rpx;font-size: 35rpx;margin-bottom: 10rpx;">
								<checkbox :value="answerItem" style="margin-right: 10rpx;transform:scale(0.9)"/>{{answerItem}}
							</label>
						</view>
					</checkbox-group>
				</template>
				<template v-else>
					<radio-group @change="changeRadio(index,$event)" style="width: calc( 100% - 40rpx );">
						<view style="width: 100%;display: flex;flex-flow: wrap;margin-top: 20rpx;padding-bottom: 20rpx;">
							<label v-for=" ( answerItem, answerIdx ) in item.answerList " :key="answerIdx" style="margin-right: 20rpx;font-size: 35rpx;margin-bottom: 10rpx;">
								<radio :value="answerItem" style="margin-right: 10rpx;transform:scale(0.9)"/>{{answerItem}}
							</label>
						</view>
					</radio-group>
				</template>
			</view>
			
			<view style="width: 100%;padding-top: 20rpx;padding-bottom: 40rpx;">
				<view class="add-btn" @click="returnAdvisoryvideo">完成</view>
			</view>
		</view>
	</view>
</template>

<script>
	export default {
		data() {
			return {
				problemsList: undefined,
				problemsList1:[ // 男性问题
					{
						title: '您的身体冷热感受如何？',
						type: 'm',
						answerList: ['冷热正常','怕冷','怕风','持续发热','周身发热','手足心热','胸腹热','上热下寒','忽冷忽热']
					},{
						title: '您的出汗情况如何？',
						type: 'm',
						answerList: ['出汗正常','基本不出汗','静坐时会出汗','睡觉时容易盗汗','仅头部出汗','手足心出汗明显','心胸部出汗明显','经常大汗淋漓']
					},{
						title: '您的身体是否有疼痛？',
						type: 'm',
						answerList: ['身体无疼痛','头痛','牙痛','胸痛','胁肋痛','胃痛','腹痛','背痛','腰痛','肩颈痛','肌肉痛','关节痛','四肢疼痛','周身疼痛']
					},{
						title: '您的身体除疼痛外是否还有以下不适？',
						type: 'm',
						answerList: ['身体无其他不适','头晕','胸闷','胁肋胀','胃胀','恶心反胃','腹胀','心慌心悸','手脚常年冰凉','头重脚轻','疲乏无力','皮肤发麻','四肢麻木']
					},{
						title: '你的眼部是否有不适？',
						type: 'm',
						answerList: ['无眼部不适','眼睛干涩','眼睛胀痛','眼睛红赤','眼睛充血','眼睛瘙痒','视物不清','夜盲','迎风流泪','眼睛分泌物过多']
					},{
						title: '您的耳部是否有不适？',
						type: 'm',
						answerList: ['无耳部不适','耳鸣','听力下降','耳聋']
					},{
						title: '您的口部是否有不适？',
						type: 'm',
						answerList: ['无口部不适','口苦','口淡','口酸','口咸','口麻','口甜','口臭','口黏腻','嘴唇干裂']
					},{
						title: '您的咽喉是否有不适？',
						type: 'm',
						answerList: ['无咽喉不适','咽干','咽痒','咽痛','吞咽困难','咽部有异物感']
					},{
						title: '您是否有咳嗽喘痰等症状？',
						type: 'm',
						answerList: ['无咳嗽喘痰','咳嗽','气喘','痰少','痰多','黄痰','白痰','痰粘稠','痰稀或有泡沫','痰中带血','痰不易吐出']
					},{
						title: '您的睡眠情况如何？',
						type: 'm',
						answerList: ['睡眠正常','入睡难','彻夜难眠','睡觉打鼾','睡觉时肢体抽搐','无梦','多梦','易醒','早醒','嗜睡']
					},{
						title: '您的口渴及饮水情况如何？',
						type: 'm',
						answerList: ['饮水正常','很少口渴','经常口渴','喜喝热水','喜喝凉水','喝水呛咳']
					},{
						title: '您的大便频率如何？',
						type: 'd',
						answerList: ['大便每天或隔天一次','大便一天几次','大便几天一次','长期便秘']
					},{
						title: '您的大便形状如何？',
						type: 'm',
						answerList: ['大便形状正常','大便不成型','稀水样便','大便粘稠','大便干结','便中有未消化的食物']
					},{
						title: '您的大便颜色如何？',
						type: 'd',
						answerList: ['大便色黄','大便发黑','大便呈白色','大便呈青绿色','便血']
					},{
						title: '您的小便频率（5-8次/日正常）及尿量如何？',
						type: 'm',
						answerList: ['小便频率正常','小便次数偏多','小便次数偏少','尿量增多','尿量减少','夜尿多']
					},{
						title: '您的小便色质如何？',
						type: 'm',
						answerList: ['小便清','小便淡黄','小便黄','小便发黑','尿血','小便浑浊如米泔水','小便中有砂石']
					},{
						title: '您是否有以下性功能障碍？',
						type: 'm',
						answerList: ['无性功能障碍','阳痿','早泄','晨勃消失','频繁遗精','睾丸疼痛']
					},{
						title: '您是否曾患过以下疾病？',
						type: 'm',
						answerList: ['未患有不育','前列腺','睾丸相关疾病','前列腺','附睾炎','睾丸炎','尿道炎','不育']
					}
				],
				problemsList2:[ // 女性问题
					{
						title: '您的身体冷热感受如何？',
						type: 'm',
						answerList: ['冷热正常','怕冷','怕风','持续发热','周身发热','手足心热','胸腹热','上热下寒','忽冷忽热']
					},{
						title: '您的出汗情况如何？',
						type: 'm',
						answerList: ['出汗正常','基本不出汗','静坐时会出汗','睡觉时容易盗汗','仅头部出汗','手足心出汗明显','心胸部出汗明显','经常大汗淋漓']
					},{
						title: '您的身体是否有疼痛？',
						type: 'm',
						answerList: ['身体无疼痛','头痛','牙痛','胸痛','胁肋痛','胃痛','腹痛','背痛','腰痛','肩颈痛','肌肉痛','关节痛','四肢疼痛','周身疼痛']
					},{
						title: '您的身体除疼痛外是否还有以下不适？',
						type: 'm',
						answerList: ['无其他不适','头晕','胸闷','胁肋胀','胃胀','恶心反胃','腹胀','心慌心悸','手脚常年冰凉','头重脚轻','疲乏无力','皮肤发麻','四肢麻木']
					},{
						title: '你的眼部是否有不适？',
						type: 'm',
						answerList: ['无眼部不适','眼睛干涩','眼睛胀痛','眼睛红赤','眼睛充血','眼睛瘙痒','视物不清','夜盲','迎风流泪','眼睛分泌物过多']
					},{
						title: '您的耳部是否有不适？',
						type: 'm',
						answerList: ['无耳部不适','耳鸣','听力下降','耳聋']
					},{
						title: '您的口部是否有不适？',
						type: 'm',
						answerList: ['无口部不适','口苦','口淡','口酸','口咸','口麻','口甜','口臭','口黏腻','嘴唇干裂']
					},{
						title: '您的咽喉是否有不适？',
						type: 'm',
						answerList: ['无咽喉不适','咽干','咽痒','咽痛','吞咽困难','咽部有异物感']
					},{
						title: '您是否有咳嗽喘痰等症状？',
						type: 'm',
						answerList: ['无咳嗽喘痰','咳嗽','气喘','痰少','痰多','黄痰','白痰','痰粘稠','痰稀或有泡沫','痰中带血','痰不易吐出']
					},{
						title: '您的睡眠情况如何？',
						type: 'm',
						answerList: ['睡眠正常','入睡难','彻夜难眠','睡觉打鼾','睡觉时肢体抽搐','无梦','多梦','易醒','早醒','嗜睡']
					},{
						title: '您的口渴及饮水情况如何？',
						type: 'm',
						answerList: ['饮水正常','很少口渴','经常口渴','喜喝热水','喜喝凉水','喝水呛咳']
					},{
						title: '您的大便频率如何？',
						type: 'd',
						answerList: ['大便每天或隔天一次','大便一天几次','大便几天一次','长期便秘']
					},{
						title: '您的大便形状如何？',
						type: 'm',
						answerList: ['大便形状正常','大便不成型','稀水样便','大便粘稠','大便干结','便中有未消化的食物']
					},{
						title: '您的大便颜色如何？',
						type: 'd',
						answerList: ['大便色黄','大便发黑','大便呈白色','大便呈青绿色','便血']
					},{
						title: '您的小便频率（5-8次/日正常）及尿量如何？',
						type: 'm',
						answerList: ['小便频率正常','小便次数偏多','小便次数偏少','尿量增多','尿量减少','夜尿多']
					},{
						title: '您的小便色质如何？',
						type: 'm',
						answerList: ['小便清','小便淡黄','小便黄','小便发黑','尿血','小便浑浊如米泔水','小便中有砂石']
					},{
						title: '您现在是否处于以下特殊阶段？',
						type: 'd',
						answerList: ['备孕中','孕期','哺乳期','更年期','围绝经期','非特殊时期']
					},{
						title: '您的生育情况如何？',
						type: 'd',
						answerList: ['未生育','生育1次','生育2次以上']
					},{
						title: '您的流产情况如何？',
						type: 'd',
						answerList: ['未曾流产','流产1次','流产2次及以上']
					},{
						title: '您的月经是否规律？',
						type: 'd',
						answerList: ['已绝经','月经规律','月经提前','月经延迟','月经不规律']
					},{
						title: '您的月经量是否正常？',
						type: 'd',
						answerList: ['已绝经','月经量正常','月经量过多','月经量过少','月经淋漓不尽','闭经']
					},{
						title: '您的月经经色、经质如何？',
						type: 'm',
						answerList: ['已绝经','月经经色淡红','月经经色鲜红','月经经色暗红','月经经色发黑','月经有血块','月经经色粘稠','月经经色质稀']
					},{
						title: '您的白带情况是否正常？',
						type: 'm',
						answerList: ['白带正常','白带量多','白带发黄','白带混有血液','白带有其他颜色','白带有腥臭味','阴部瘙痒']
					}
				],
				problems: [],
				answer: []
			};
		},
		onLoad(options) {
			if(options.sex=='男'){ // 男
				this.problemsList = JSON.parse(JSON.stringify(this.problemsList1)) 
			}else{
				this.problemsList = JSON.parse(JSON.stringify(this.problemsList2)) 
			}
			this.problems = this.problemsList.map(item=>item.title)
			this.answer = this.problemsList.map(()=>'')
		},
		methods: {
			changeRadio(idx,evt){
				this.answer[idx] = evt.target.value
			},
			changeCheckbox(idx,evt){
				let boxV = evt.target.value
				this.answer[idx] = boxV.join('/')
			},
			//跳转回视频咨询或者图文咨询页面
			returnAdvisoryvideo() {
				let isNoC = false
				let noproblem = ''
				for(let i=0,j=this.answer.length;i<j;i++){
					if(this.answer[i].length ==0){
						isNoC = true
						noproblem = this.problems[i]
						break;
					}
				}
				if(isNoC){
					uni.showToast({
						title: noproblem+',未选择',
						icon: 'error'
					})
					return
				}
				let pages = getCurrentPages();
				let prevPage = pages[pages.length-2]
				prevPage.$vm.problems = this.problems.join(',')
				prevPage.$vm.answer = this.answer.join(',')
				uni.navigateBack({
					delta:1
				})
			}
		}
	};
</script>

<style lang="less">
	.add-btn{
		margin: auto;
		height: 88rpx;
		line-height: 88rpx;
		width: 90%;
		background: linear-gradient(90deg, #F1BAB2 0%, #F78D7D 100%);
		box-shadow: 0px 20rpx 25rpx 0px rgba(247,141,125,0.4);
		border-radius: 44rpx;
		color: #FFFFFF;
		text-align: center;
	}
</style>
